package com.sc.javaee.service.impl;


import com.sc.javaee.mapper.ProductsMapper;
import com.sc.javaee.pojo.Products;
import com.sc.javaee.service.ProductsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ProductsServiceImpl implements ProductsService {
    @Autowired
    ProductsMapper mapper;
    public List<Products> getProducts(Integer categoryId) {
        return mapper.getProducts(categoryId);
    }
    public List<Products> getRandomProducts() {
        return mapper.getRandomProducts();
    }
    public List<Products> searchProducts(Integer categoryId, String keyword) {
        return mapper.searchProducts(categoryId, keyword);
    }
    public List<Products> searchAllProducts(String keyword) {
        return mapper.searchAllProducts(keyword);
    }

    public Products getProductDetail(Integer productId) {
        return mapper.selectByPrimaryKey(productId);
    }

}
